# This is a sample Python script.

# Press Shift+F10 to execute it or replace it with your code.
# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings.


def print_hi(name):
    # Use a breakpoint in the code line below to debug your script.
    print(f'Hi, {name}')  # Press Ctrl+F8 to toggle the breakpoint.


# Press the green button in the gutter to run the script.
if __name__ == '__main__':
    print_hi('PyCharm')

# See PyCharm help at https://www.jetbrains.com/help/pycharm/
import random
quit = 0 #0即不退出，1即退出
while quit == 0:
    print("请选择难度:1(初级)、2(中级)、3(高级)")
    level = int(input())
    item = 100
    if level == 1:
      pass
    elif level == 2:
      item = 500
    elif level == 3:
      item = 10000
    answer = random.randint(1,item)
    guess=int(input("请输入你猜的数："))
    flag = 0
    while flag == 0:
        if guess == answer:
          print("太棒了！恭喜你！终于猜对了！")
          flag=1
        elif guess > answer:
          print("您猜的数大了！",end="")
          guess=int(input("请输入小一点的数："))
        else:
          print("您猜的数小了！",end="")
          guess=int(input("请输入大一点的数："))
    quit = int (input("是否继续?输入0继续,输入1退出:"))